package move.method;

/**
 * Created by Administrator on 2018/1/25.
 */
public class Account {

    private int daysOverdrawn;
    private AccountType type;

    //搬移该函数到AccoutType去
    double overdraftCharge() {
//        if (type.isPremium()) {
//            double result = 10;
//            if (daysOverdrawn > 7) {
//                result += (daysOverdrawn - 7) * 0.85;
//                return result;
//            } else {
//                return daysOverdrawn * 1.75;
//            }
//        }
//        return 0;
        return type.overdraftChargeRF(daysOverdrawn);
    }

    double bankCharge() {
        double result = 4.5;
        if (daysOverdrawn > 0) {
//            如果没有删除原函数,则不需要进行函数的改变
//            result += overdraftCharge();
            //如果删除了原函数需要进行改变
            result += type.overdraftChargeRF(daysOverdrawn);
            return result;
        }
        return 0;
    }

    public int getDaysOverdrawn() {
        return daysOverdrawn;
    }
}
